package com.taxshare.purchaser.controller;

import com.taxshare.purchaser.service.InvoiceBatchOperationService;
import com.taxshare.purchaser.view.dto.InvoiceBatchOperationDTO;
import com.taxshare.purchaser.view.dto.InvoiceBatchOperationMainDTO;
import com.taxshare.response.beans.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName: InvoiceBatchOperationController
 * @Description:发票删除和更新
 * @author: zy
 * @date:
 */
@RestController
@RequestMapping(value = "/invoicebatch")
@Api(tags = "发票删除")
public class InvoiceBatchOperationController {

    @Autowired
    InvoiceBatchOperationService invoiceBatchOperationService;

    @PostMapping("/invoicecode/delete")
    @ApiOperation(value = "发票批量删除接口（发票发票代码和号码）")
    public Response deleteInvoiceCodeAndNo(@RequestBody InvoiceBatchOperationMainDTO invoiceBatchOperationMainDTO) {
        return invoiceBatchOperationService.deleteInvoiceCode(invoiceBatchOperationMainDTO);
    }

    @PostMapping("/operationdocno/delete")
    @ApiOperation(value = "发票批量删除接口（单据号）")
    public Response deleteInvoiceDocno(@RequestBody List<String> docnolist) {
        return invoiceBatchOperationService.deleteDocno(docnolist);
    }

    @PostMapping("/operationdocno/update")
    @ApiOperation(value = "发票（批量）更新审批状态和单据号接口（根据发票代码和号码）")
    public Response updateInvoiceCodeAndNo(@RequestBody List<InvoiceBatchOperationDTO> invoiceBatchOperationDTOList) {
        return invoiceBatchOperationService.updateDocno(invoiceBatchOperationDTOList);
    }

    @PostMapping("/operationdocno/updateStatus")
    @ApiOperation(value = "发票（批量）更新报销状态（根据发票代码和号码）")
    public Response updateReimbursementStatus(@RequestBody InvoiceBatchOperationMainDTO invoiceBatchOperationMainDTO) {
        return invoiceBatchOperationService.updateReimbursementStatus(invoiceBatchOperationMainDTO);
    }

/*    @PostMapping("/operationdocno/add")
    @ApiOperation(value = "发票（批量）增加审批状态和单据号接口（根据发票代码和号码）")
    public Response addOperation(@RequestBody String fileaddress) throws IOException, InvalidFormatException {
        return invoiceBatchOperationService.addDocno(fileaddress);
    }*/

}
